package src.A_JavaBase;

// 自定义异常类
public class Oop06 extends Exception{

    private int detail;

    public Oop06(int detail) {
        this.detail = detail;
    }

    @Override
    public String toString() {
        return "大于10，异常咯！{" +
                "detail=" + detail +
                '}';
    }

}

class Test{

    public void test(int a) throws Oop06 {
        if (a>10){
            throw new Oop06(a);
        }
        System.out.println("OK");
    }

    public static void main(String[] args) {
        try {
            new Test().test(19);
        } catch (Oop06 e) {
            System.out.println(e);
        }
    }
}
